Installing TrinityCore on recent Linux-based systems
UPDATED : 2010.09.06 22:00 GMT TrinityCore is a rather complex and demanding software, and as such it may seem quite daunting to install and maintain. This howto will attempt to help with this, and also show how this can be done in a way that also shows you the basics of how linux compilations works. We also advice you to read your distributions documentation on how to install packages, and also have at least knowledge on how it works with regards to adding users. Most of this howto is based on the use of a Debian-based distribution, though we'll try to inform as best as we can when something differs totally. Important: As the TrinityCore project is highly active, portions of the guide may be outdated. In case something fails, please check the forum, which will usually have the answer already. Getting started We advice you to run/install TrinityCore on a dedicated machine, or a machine that you know you have full control over. We also advice you to NOT install the software on a shared serversolution or any server where other users may have access or might require resources to be available at all times. Your server may be unabruptedly killed by an angry administrator or system staff for overuse of system resources. Package requirements This list gives an absolute minimum of packages required to work with a basic install of TrinityCore, and is in no way ment as "the ultimate solution of packages". Please read the distribution documentation or other howtos on other packages / solutions that you might want installed, for example LAMP (Linux w/Apache, MySQL and PHP). Debian-based distributions sudo apt-get install build-essential autoconf libtool gcc g++ make cmake subversion mercurial patch wget links zip unzip unrar sudo apt-get install openssl libssl-dev mysql-server mysql-client libmysqlclient15-dev libmysql++-dev libreadline5-dev zlib1g-dev libbz2-dev RedHat-based distributions Redhat-based distributions does not (as far as we know) include CMake by default, and requires extra repositories to be enabled. Please refer to the distributions archive and/or secondary repositories (ex. RPMForge). Installation of the packages mentioned underneath will require either root-privileges, or the use of sudo prepended to the respective commands. yum groupinstall "development tools" yum groupinstall "development libraries" yum install gcc-g++ mercurial wget links zip unzip unrar yum install mysql-server mysql-client mysql-devel yum install openssl Not included in default package-repositories (as mentioned above) yum install cmake Creating a user to work with Start with logging in to your Linux-machine and create an account for the server itself - on most recent distributions this can easily be done with the following command : sudo adduser Note : Change into the preferred username of your server-account - we will as far as possible avoid using specific usernames in this howto. Installing ACE (Adaptive Communication Environment) TrinityCore requires a specific communication-library for inter-process communication, and as such needs special attention on that matter. This due to that most distributions (even the most recent ones) does not supply the version required by TrinityCore as part of their basepackages by default. To start the installation, log in to your previously created user : su - cd ~/ Replace with the username you chose when creating the account. Downloading and unpacking the ACE-library wget http://download.dre.vanderbilt.edu/previous_versions/ACE-5.7.8.tar.gz tar xvzf ACE-5.7.8.tar.gz cd ~/ACE_wrappers/ mkdir build cd build Configuring, compiling and installing ACE IMPORTANT : If you are the owner of the machine, and at this stage want the ACE-library to be available for other users on your Linux-machine (and also making it easier for yourself at later stages), please follow 'alternative 2' Alternative 1 : Local installation ../configure --prefix=/home//.sys/ make make install Again, replace with the username you chose when creating the account. Alternative 2 : Systemwide installation ../configure make sudo make install As stated above, alternative 2 will build the library as a user without any specific privileges, and then install it into /usr/local as root (the superuser), reachable for other users that wish to use it for their own projects. It is safe safe to allow this library to be installed systemwide. Installing OpenSSL (aka libSSL) The entire procedure here is for people that do believe they need the latest revision - normally the version that comes with your distribution is sufficient enough. The procedure described here has been created on a time that the version 0.9.8o was the newest one, it also should work on newer ones. So if you want a newer (or maybe older) version check ftp://ftp.debian.org/debian/pool/main/o/openssl/ 32-bit Debian-based distributions wget ftp://ftp.debian.org/debian/pool/main/o/openssl/libssl-dev_0.9.8o-2_i386.deb wget ftp://ftp.debian.org/debian/pool/main/o/openssl/libssl0.9.8_0.9.8o-2_i386.deb wget ftp://ftp.debian.org/debian/pool/main/o/openssl/openssl_0.9.8o-2_i386.deb sudo dpkg -i libssl0.9.8_0.9.8o-2_i386.deb sudo dpkg -i openssl_0.9.8o-2_i386.deb sudo dpkg -i libssl-dev_0.9.8o-2_i386.deb 64-bit Debian-based distributions wget ftp://ftp.debian.org/debian/pool/main/o/openssl/libssl-dev_0.9.8o-1_amd64.deb wget ftp://ftp.debian.org/debian/pool/main/o/openssl/libssl0.9.8_0.9.8o-1_amd64.deb wget ftp://ftp.debian.org/debian/pool/main/o/openssl/openssl_0.9.8o-1_amd64.deb sudo dpkg -i libssl0.9.8_0.9.8o-1_amd64.deb sudo dpkg -i openssl_0.9.8o-1_amd64.deb sudo dpkg -i libssl-dev_0.9.8o-1_amd64.deb Other distributions For cases where you want to run an even newer release of OpenSSL than mentioned here, or your distribution not supplying a version that isn't of recent date, please check your distributions repositories or documentation. You can also retrieve it as sourcecode at http://openssl.org/source (feel free to use newer packages if you really feel like it). To build it from sourcecode, here's a primer : wget http://openssl.org/source/openssl-0.9.8o.tar.gz tar -xvf openssl-0.9.8o.tar.gz cd openssl-0.9.8o Alternative 1 : Local installation ./config --prefix=/home//.sys shared make make install Replace with the username you chose when creating the account. Alternative 2 : Systemwide installation ./config shared make sudo make install Please note that any old revision of the OpenSSL package installed by the distribution may/will interfere with the new version. See your distribution documentation for information on how to remove it to be able to use the new one. If you have done the systemwide install, you will no longer need any extra parameters for SSL when compiling TrinityCore. Optional software These tools are only needed or useful if you are connecting from a Windows host to your Linux machine Graphical database-viewing/editing *HeidiSQL *SQLyog Please note that the software called Navicat is NOT supported due to issues with how it handles SQL-files with "/* */"-style comments. We advice all users to stay well clear of this program unless they really are looking for issues. Remote console connects to the server *Putty *Putty Tray Filetransfer through SFTP or FTP *WinSCP Building the server itself Getting the sourcecode cd ~/ git clone git://github.com/TrinityCore/TrinityCore.git A directory trinitycore will be created automatically and all the source files will be stored in there. Compiling the sourcecode Creating the build-directory To avoid issues with updates and colliding sourcebuilds, we create a specific build-directory, so we avoid any possible issues due to that (if any might occur) mkdir build cd build Configuring for compiling To configure the core, we use space-separated parameters attached to the configuration-tool (cmake) - do read the entire section before even starting on the configuration-part. This is for your own good, and you HAVE been warned. A full example will also be shown underneath the explanations. cmake ../trinitycore/ parameters Parameter explanations -DACE_LIBRARY= (full path to your libACE.so file INCLUDING the filename - do not use if you have ACE installed systemwide) -DACE_INCLUDE_DIR= (path to the libACE include directory - do not use if you have ACE installed systemwide) -DOPENSSL_LIBRARIES= (path to your OpenSSL library - do not use if you have OpenSSL installed systemwide) -DOPENSSL_INCLUDE_DIR= (path to your OpenSSL includes directory - do not use if you have OpenSSL installed systemwide) -DSERVERS Build worldserver and authserver -DSCRIPTS Build core with scripts included -DTOOLS Build map/vmap extraction/assembler tools -DUSE_SCRIPTPCH Use precompiled headers when compiling scripts -DUSE_COREPCH Use precompiled headers when compiling servers -DUSE_SFMT Use SFMT as random numbergenerator -DWITH_WARNINGS Show all warnings during compile -DWITH_COREDEBUG Include additional debug-code in core -DWITH_SQL Copy SQL files during installation -DPREFIX Set installation directory -DCONF_DIR Set configuration directory -DLIBSDIR Set library directory -DCMAKE_C_FLAGS Set C_FLAGS for compile (advanced users only) -DCMAKE_CXX_FLAGS Set CXX_FLAGS for compile (advanced users only) Note : * means "used by default", and does not need to be set. The above parameters when combined into a full example : cmake ../trinitycore/ -DPREFIX=/home//server -DWITH_SQL=1 The above build the servers, set installation base directory to /home//server and install the SQL-files into the server-directory under the /home//server/shared/trinity/sql/ directory. Note that you WILL have to configure the server well if you ever want to use the RA-access functionality. Building the core After configuring and checking that everything is in order (read cmakes output), you can build Trinity (this will take some time unless you are on a rather fast machine) make make install If you have multiple CPU cores, you can enable the use of those during compile : make -j make install After compiling and installing, you will find your core binaries in /home//server/bin, and the standard configuration files in the /home//server/etc folder. (As usual, replace with the username you created earlier). Now you can continue reading on and learn how how to update the sourcetree. Keeping the code up to date TrinityCore developers are always at work fixing and adding new features to the core. You can always check them here. To update the core files, do the following : cd ~/trinitycore/ hg pull -u Now return to the compilation-section again, and repeat the instructions there. Installing libMPQ (MoPaQ) MPQ-reader library Installation of the libMPQ library is only required if you want to extract the datafiles, and/or compile the tools. Do note that the library has been hardlinked to the binary in later revisions, and is not "enforced" unless the tools are required. Configuring, compiling and installing libMPQ IMPORTANT : If you are the owner of the machine, and at this stage want the MPQ-library to be available for other users on your Linux-machine (and also making it easier for yourself at later stages), please follow 'alternative 2' Change directory to /externals/libmpq/ before doing this Alternative 1 : Local installation sh ./autogen.sh ./configure --prefix=/home//.sys/ make make install Again, replace with the username you chose when creating the account. Alternative 2 : Systemwide installation sh ./autogen.sh ./configure make sudo make install As stated above, alternative 2 will build the library as a user without any specific privileges, and then install it into /usr/local as root (the superuser), reachable for other users that wish to use it for their own projects. It is safe safe to allow this library to be installed systemwide. Installing the databases Fetching the databases Simply type in the users homedirectory the following : hg clone http://trinitydb.googlecode.com/hg/ trinitydb A folder trinitydb will be created and all files will be stored in there. About the MySQL server installation When configuring MySQL make sure you remember the password you set for the default root account and that you enabled both MyISAM and InnoDB engines. You can leave all the other settings as default. You might want to enable remote access to your MySQL server if your are also testing a website for your Trinity server or if you have friends testing with you which need access from remote locations. Remember that this will decrease the security of your MySQL server in general, and is not adviced without prior knowledge on how to secure it. Installing the Trinity DataBase Project (TDB) database NOTE: This guide is only for a fresh and new installation of TDB, so do not follow this if you already have a working database. You have been warned, all database content will disappear if you do. A short primer on what the databases do Trinity needs three databases to run: *auth (contains realm- and account-data (logins/passwords and accesslevels ++) (Previously named realmd. If you are searching the forum for help, any reference to realmd now applies to auth) *characters (contains characterdata and certain worldstates) *world (contains gamecontent such as spawns, quests, stats, etc.) Installing the databases The first two are taken from the core installation directory, while the world database is taken from the TDB directory. #Create the three databases by importing /home//server/sql/create_mysql.sql - you now have three databases called auth, characters and world #Import auth database structure by importing /home//trinitycore/sql/auth_database.sql into the auth DB. #Import characters database structure by importing /home//trinitycore/sql/characters_database.sql into the characters DB. #Unzip /home//trinitydb/fulldb/TDB_335.10.32_8874.zip and import world DB structure and contents by importing TDB_335.10.32_8874.sql in the world DB. #Import all *.sql update files from /home//trinitycore/sql/updates/ which start with a number above '8874' so that your DB structure is up to date with the revision you just pulled and compiled. Also note that we STILL use the generic extension here, use the username you created for the server earlier! Now your world database-structure is for TrinityCore revision 8874. You need to import the update files to have the proper world/characters/auth database-structures for the revision you just pulled and compiled. You will notice they are all named XXXX_world_tablename.sql or XXXX_character_tablename.sql or XXXX_auth_tablename.sql - make sure to import these into the correct database. XXXX_world_tablename.sql ---> world database XXXX_character_tablename.sql ---> characters database XXXX_auth_tablename.sql ---> auth database Keeping the database up to date TDB developers are always at work fixing and adding new data to the database, but unlike core development, database updatepacks come more on a 1-2 times a month basis with many fixes from the forum and a lot of new data from developers and contributors. We'll use the same same procedure as for updating core, just on the databasefiles instead. cd ~/trinitydb hg pull -u Setting up the server Now that you have the source compiled and the databases installed, you need to set up the server. Extracting dbc, maps and vmaps files In order to run, TrinityCore needs dbc- and map-files. In addition, if you want to enable vmaps (Making NPCs unable to see through walls etc.) you will need to extract them as well. Warning: use Trinity's extractors. If you use extractors from other projects it is almost certain that your Trinity Core will not recognize the extracted data! To get the Trinity extractors you have to build the project with option -DTOOLS=1 (Parameter_explanations). dbc and maps files cd /home//server/bin/mapextractor cp -r dbc maps /home//server/data Visual Maps (aka vmaps - optional) You can also extract vmaps which will take quite a while depending on your machine (1-2 hours). cd /home//server/bin/vmap3extractor mkdir vmaps /home//server/bin/vmap3assembler Buildings vmaps cp -r vmaps /home//server/data Configuring the server First of all you need to create 2 files : worldserver.conf and authserver.conf in your /home//server/etc/ folder. You'll find 2 files named worldserver.conf.dist and authserver.conf.dist. Copy these to their namesakes without the .dist extension. cp worldserver.conf.dist worldserver.conf cp authserver.conf.dist authserver.conf Now you can go ahead and edit the two files (worldserver.conf and authserver.conf) to your liking, with the following notes in mind about them : worldserver.conf Edit MySQL account username and password (instead of trinity;trinity). LoginDatabaseInfo = "127.0.0.1;3306;trinity;trinity;auth" WorldDatabaseInfo = "127.0.0.1;3306;trinity;trinity;world" CharacterDatabaseInfo = "127.0.0.1;3306;trinity;trinity;characters" If you extracted vmaps then edit the following : vmap.enableLOS = 1 <--- set this to 1 vmap.enableHeight = 1 <--- set this to 1 vmap.ignoreMapIds = "369" vmap.ignoreSpellIds = "7720" vmap.petLOS = 1 <--- set this to 1 authserver.conf Edit MySQL account username and password (instead of trinity;trinity). LoginDatabaseInfo = "127.0.0.1;3306;trinity;trinity;auth" Realmlist table You need to make sure that the authserver directs incoming connections to your realm. In the auth database there is a table called realmlist, where you need to edit the field address '''according to your needs : 127.0.0.1 -- Leave default localhost if you are connecting alone from the same machine TrinityCore runs on. -- Use the machine's LAN ip if you want other computers from the same network as the TrinityCore server to connect to your server. -- Use your PUBLIC ip if you have friends and testers which need to connect your server from the internet. Support and conclusion This guide is for beginners and states what to do and what to edit, assuming you left everything else with default values. Visit the following threads and post questions if you still need special support: *TortoiseHG *Compiling the Source *Installing the Database ''Warning: The TrinityCore development team/owners and the TrinityDB team/owners DO NOT in any case sponsor nor support illegal public servers. If you use these projects to run an illegal public server and not for testing and learning it is your own personal choice.'' SPECIAL NOTES! Things to notice : -DLARGE_CELL=0 '''has been deprecated and is not used at all (remove this if ever used before) -DMYSQL=1 ' has been deprecated and is not used at all (remove this if ever used before)' -DSSLLIB= has been deprecated and is not used at all (remove this if ever used before) -DRA=0 has been deprecated, it is handled directly in worldserver.conf -DCLI=0 has been deprecated, it is handled directly in worldserver.conf -DWITH_COREDEBUG=0 not required, as its default is : 0 The new method for custom SSL-libraries are: -DOPENSSL_LIBRARIES= -DOPENSSL_INCLUDE_DIR= The paths for installation can be done without any other parameters but this : -DPREFIX=/path/to/where/you/want/core/to/be/installed It will create the following structure: /bin/ '- binaries will be placed here' /etc/ '- configfiles will be placed here' Also, compile has been tested on Debian 5.0.4 x32/x64, Ubuntu 10.04 x32/x64, Centos 5.4 x32/x64 - all without problems IF YOU DO NOT MESS AROUND ON YOUR OWN! If you have issues with OpenSSL-libraries, look at http://trinitycore.info/index.php/Howto_linux_tc2#Installing_OpenSSL_.28aka_libSSL.29 Do NOT add your own compiled libraries on recent distributions, this is highly unneeded, and will just add confusion.